<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.xyj.zjbz.po.*"%>
<%@ taglib prefix="security"  
    uri="http://www.springframework.org/security/tags"%> 
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>登陆页面</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript"
	src="<%=path%>/statics/js/jquery-1.11.2.min.js"></script>
</head>
<script type="text/javascript">
  $(function(){
	  $("#login").click(function(){
		 var data= $("#loginform").serialize();
		  $.ajax({
			  url:"<%=path%>/user/valid",
			  data:data,
			  type:"post",
			  dataType:"json",
			  success:function(d){
			   if(d.status=='-1'){
				  alert("用户名不存在");
			  	}else if(d.status=='-2'){
				  alert("密码错误");
	  			}else{
	  			window.location.href='<%=path%>/user/info';
					}
				}

			});

		});

	});
</script>
<body>
	<hr style="border: 2px solid red">
	<fieldset style="width: 400px;height: 200px;margin: auto">
		<legend style="text-align: center;">登陆</legend>
<%-- 		<form id="loginform" action="<%=request.getContextPath()%>/user/valid"
			method="post">
			<br><br>
			用户名<input name="userName"><br><br>
			密 &nbsp;码<input type="password" name="pwd">
			<br><br> 
			<input type="button" id="login" value="login">
		</form> --%>
		<form id="loginform" action="login"
			method="post">
			<br><br>
			用户名<input name="username"><br><br>
			密 &nbsp;码<input type="password" name="password">
			<br><br> 
			<input type="submit"   value="login">
		</form>
	</fieldset>
</body>
</html>
